package com.itheima.web.controller;

import java.io.Serializable;

/**
 * @program: mm_exam
 * @description:
 * @author: zhanghz001
 * @create: 2020-10-19 08:51
 **/
public class Result implements Serializable {
    private static final long serialVersionUID = 197042588282742444L;
    //
    //对应操作的返回消息
    private String message;
    //对应操作的返回结果是否成功
    private Boolean flag;
    //对应操作返回的具体数据
    private Object data;
    //对应操作的返回状态码
    private Integer code;

    public Result(String message, Object data) {
        this.code = Code.SUCCESS;
        this.data = data;
        this.flag = true;
        this.message = message;
    }

    public Result() {
    }

    public Result(Integer code, Object data, boolean flag, String message) {
        this.code = code;
        this.data = data;
        this.flag = flag;
        this.message = message;
    }

    @Override
    public String toString() {
        return "Result{" +
                "code=" + code +
                ", data=" + data +
                ", flag=" + flag +
                ", message='" + message + '\'' +
                '}';
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public boolean isFlag() {
        return flag;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
